const { Model } = require('../index');

class Entries extends Model {
    static get tableName() {
        return 'entry';
    }

    static get relationMappings() {
        return {
            // Create a mapping with the user model
            user: {
                relation: Model.BelongsToOneRelation,
                modelClass: `${__dirname}/user.js`,
                // Where the two are joined
                join: {
                    from: 'entry.userId',
                    to: 'user.id'
                }
            }
        };
    }
}

module.exports = Entries;